﻿<%@ page language="java" pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>奋青网-个人中心</title>
<link href="css/Main.css" rel="stylesheet" type="text/css" />
<link href="css/Pro.css" rel="stylesheet" type="text/css" />
<link href="css/boxy.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/Jquery-1-5-2.js"></script>
<script type="text/javascript" src="js/jquery.boxy.js"></script>
<script type="text/javascript" src="js/Main.js"></script>
<script type="text/javascript" src="js/Pro.js"></script>
<script type="text/javascript">
<!--
	function getPid(pid){
		window.pid = pid ;
	}
	function send(uid){
		location.href="?lx=private&uid=${sessionScope.user}&spuid="+uid;
	}
	
	function getUname(uname){
		var name = document.send.uname ;
		name.value = uname ;
	}
	function getUid(uid){
		window.uid = uid ;
		var send = document.send.puid ;
		send.value = uid ;
		var ul = document.getElementById('User_Result');
		ul.innerHTML = null ;
	}
	function getDel(params){
	   if(window.confirm('你确定要删除吗？删除之后，不可恢复!')){
	   		window.location = params ;
	   }
	}
	
	function seek(name){    //搜索在线人员
		name = encodeURI(name);
		$.ajax({
			type:"POST" ,
			url:"Pro?lx=private&action=seek&name="+name ,
			dateType:"text" ,
			async:false ,
			success:seek 
		});
		function seek(list){
			var ul = document.getElementById('User_Result');
			ul.innerHTML = list ;
		}
	}
-->
</script>
<script type="text/javascript">
<!--
	function getType(){
		var type = document.form1.type ;
		var action = document.form1.action ;
		action = action.value ;
		var form = document.form1 ;
		if(type.value==2){
			form.action="${applicationScope.path }/Active";
		}else if(type.value==1){
			form.action="${applicationScope.path }/ArticleList";
		}else if(type.value==0){
			form.action="${applicationScope.path }/ClubList";
		}
	}
-->
</script>
</head>
<body>
<div id="Top">
  <div class="Top_all"> <a href="#"><img src="images/LOGO.jpg"/></a>
    <ul id="Top_Nav">
      <li><a href="${applicationScope.path }/Index">首页</a></li>
      <li><a href="${applicationScope.path }/ArticleList">领域</a></li>
      <li><a href="#">发现</a></li>
    </ul>
    <ul id="Second_Menu">
      	<li><a href="${applicationScope.path }/ClubList">发现社团</a><li>
      	<li><a href="#">对味奋青</a><li>
      	<li><a href="${applicationScope.path }/Active">有趣活动</a><li>
      </ul>
    <div id="Search">
      <div class="Search_l"></div>
      <form name="form1" method="post" action="" onsubmit="getType();">
      	<input type="hidden" name="action" value="search" />
        <input type="text" id="Search_Box" name="content" value="搜索社团、文章、活动..."/>
        <img src="images/search_btn.jpg" id="Search_Btn"/>
        <input type="hidden" value="0" id="Search_What" name="type"/>  <!--传送搜索类型参数-->
      </form>
    </div>
    <div id="Search_Option">
    	<p class="Search_Option_Hover"><img src="images/search_hover0.jpg"/>包含<span></span>的社团</p>
    	<p><img src="images/search_hover1.jpg"/>包含<span></span>的帖子</p>
    	<p><img src="images/search_hover2.jpg"/>包含<span></span>的活动</p>
    </div>
    <div id="User_Top">
    <c:choose>
    	<c:when test="${not empty sessionScope.user}">
    	<c:forEach items="${requestScope.login}" var="login">
    		<img src="${login.uphoto}"/><a href="#">${login.uname}</a>
        	<ul id="User_Info_Box">
	        	<li><a href="${applicationScope.path }/Pro?uid=${login.uid}"><img src="images/home.jpg"/>个人主页</a></li>
	        	<li><a href="${applicationScope.path }/Pro?uid=${login.uid}&lx=private"><img src="images/sms.jpg"/>私信</a></li>
	        	<li><a href="${applicationScope.path }/Pro?uid=${login.uid}&lx=edit"><img src="images/control.jpg"/>设置</a></li>
	        	<li><a href="${applicationScope.path }/Logout.jsp"><img src="images/logout.jpg"/>注销</a></li>
        	</ul>
        </c:forEach>
    	</c:when>
   	 	<c:otherwise>
    		<a href="${applicationScope.path }/Entrance.jsp">您还未登录</a>
    	</c:otherwise>
    </c:choose>
    </div>
    <img src="images/help.jpg" id="Help_Btn" title="帮助中心"/> </div>
</div>
<!--头部结束-->
<div class="Page_Top"></div>
<div class="Page_Middle">
<!--主页部分-->
<c:if test="${requestScope.lx=='index'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">资料卡</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<c:forEach items="${requestScope.users}" var="user">
        <img src="images/default_head_big.jpg" class="User_Pic" />
        <table width="580">
            <tr><td colspan="3" class="Pro_Name">${user.uname}（${user.uinfo}）</td></tr>
            <tr>
            	<td>年龄：${user.uage}岁</td>
                <td>邮箱：${user.uemail}</td>
            	<td rowspan="3"><input type="button" class="Join_Btn" onclick="send(${user.uid});" value="发私信" /><br/>
            	<c:choose>
            		<c:when test="${user.uid!=sessionScope.user}">
            			<input type="button" class="Focus_Btn" value="加关注" onclick="ajaxBox(this,'focus',${user.uid});" />
            		</c:when>
                	<c:otherwise>
                		<input type="button" class="Focus_Btn" value="加关注" disabled="true"/>
                	</c:otherwise>
                </c:choose>
                </td></tr>
            <tr><td>学校：${user.uschool}</td><td>专业：${user.ucareer}</td></tr>
            <tr><td title="${requestScope.eye}">关注领域：${requestScope.eye}</td><td title="${requestScope.gid}">擅长技术：${requestScope.gid}</td></tr>
            <tr><td>创建的社团：${user.cname}</td><td>加入的社团：<c:choose><c:when test="${user.aname=='暂无'}">${user.aname}</c:when><c:otherwise><a href="${applicationScope.path }/Club?cid=${user.cid }">${user.aname}</a></c:otherwise></c:choose></td></tr>
        </table>
        </c:forEach>
    </div>
    <p class="Page_Title">${requestScope.name}的帖子<a href="?lx=post" class="Pro_All"></a></p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<ul>
    		<c:forEach items="${requestScope.card}" var="card" end="4">
        		<li><span>发表于：${card.cdtime}</span><a href="${applicationScope.path }/QApage?pid=${card.cdid}">${card.cdtitle}</a></li>
        	</c:forEach>
        	<c:if test="${empty requestScope.card}" var="ac">
	        	<li>Ta还没有发布过帖子!</li>
	        </c:if>
        </ul>
    </div>
    <p class="Page_Title">${requestScope.name}的活动<a href="?lx=active" class="Pro_All"></a></p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<ul>
    		<c:forEach items="${requestScope.active}" var="active" end="4">
	        	<li><span>参加于：${active.jdate}</span><a href="${applicationScope.path }/Active?aid=${active.aid}">${active.aname}</a></li>
	        </c:forEach>
	        <c:if test="${empty requestScope.active}" var="ac">
	        	<li>Ta还没有参加过任何活动!</li>
	        </c:if>
        </ul>
    </div>
    <p class="Page_Title">${requestScope.name}的关注<a href="?lx=attention" class="Pro_All"></a></p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
        	<c:forEach items="${requestScope.attention}" var="attention" end="8">
        		<c:choose><c:when test="${attention.abear=='users'}"><a href="${applicationScope.path }/Pro?uid=${attention.chartid }" class="Pro_Focus"></c:when><c:otherwise><a href="${applicationScope.path }/Club?cid=${attention.chartid }" class="Pro_Focus"></c:otherwise></c:choose><img src="${attention.uphoto }"/><br/>${attention.atchart }</a>
        	</c:forEach>
    </div>
  </div>
  </c:if>
<!--关注部分-->
<c:if test="${requestScope.lx=='attention'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">关注的社团</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    <c:forEach items="${requestScope.attention}" var="attention">
    <c:if test="${attention.abear=='corporation'}">
        	<li class="Pro_Focus"><a href="${applicationScope.path }/Club?cid=${attention.chartid }"><img src="${attention.uphoto }"/><br/>${attention.atchart }</a><c:if test="${empty requestScope.state}"><span class="Delete_Mate_Btn" title="取消关注" onclick="ajaxBox(this,'unfocus',${attention.atid});"></span></c:if></li>
    </c:if>
    </c:forEach>    	
  	</div>
    <p class="Page_Title">关注的奋青</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    <c:forEach items="${requestScope.attention}" var="attention">
    <c:if test="${attention.abear=='users'}">
        	<li class="Pro_Focus"><a href="${applicationScope.path }/Pro?uid=${attention.chartid }"><img src="${attention.uphoto }"/><br/>${attention.atchart }</a><c:if test="${empty requestScope.state}"><span class="Delete_Mate_Btn" title="取消关注" onclick="ajaxBox(this,'unfocus',${attention.atid});"></span></c:if></li>
    </c:if>
    </c:forEach> 
  	</div>
  </div>
  </c:if>
<!--帖子部分-->
<c:if test="${requestScope.lx=='post'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">${requestScope.name}的帖子</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<div class="Pro_Change">
    	<c:choose>
    		<c:when test="${requestScope.lb=='hf'}">
    			<input type="button" class="Pro_Change_Btn" value='已发表' onclick="location.href='?lx=post&lb=fb';""/>
        		<input type="button" class="Join_Btn" value='已回复' disabled = "true"/>
        	</c:when>
        	<c:otherwise>
        		<input type="button" class="Join_Btn" value='已发表' disabled = "true"/>
        		<input type="button" class="Pro_Change_Btn" value='已回复' onclick="location.href='?lx=post&lb=hf';"/>
        	</c:otherwise>
        </c:choose>
        </div>
    	<ul>
        	<c:forEach items="${requestScope.card}" var="card">
        	<c:choose>
        	<c:when test="${requestScope.lb=='hf'}">
        		<li><span>回复于：${card.cdtime}</span><a href="${applicationScope.path }/QApage?pid=${card.cdid}">${card.cdtitle}</a></li>
        	</c:when>
        	<c:otherwise>
        		<li><span>发表于：${card.cdtime}</span><a href="${applicationScope.path }/QApage?pid=${card.cdid}">${card.cdtitle}</a></li>
        	</c:otherwise>
        	</c:choose>
        	</c:forEach>
        	<c:if test="${empty requestScope.card}" var="ac">
	        	<li>Ta还没有发布过帖子!</li>
	        </c:if>
        </ul>
  	</div>
  </div>
  </c:if>
  <!--问答部分-->
  <c:if test="${requestScope.lx=='QA'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">${requestScope.name}的问题</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<div class="Pro_Change">
    	<c:choose>
    		<c:when test="${requestScope.lb=='cj'}">
    			<input type="button" class="Pro_Change_Btn" value='已提出' onclick="location.href='?lx=QA&lb=tc';"/>
        		<input type="button" class="Join_Btn" value='已回答' disabled="true"/>
        	
        	</c:when>
        	<c:otherwise>
        		<input type="button" class="Join_Btn" value='已提出'  disabled="true"/>
        		<input type="button" class="Pro_Change_Btn" value='已回答' onclick="location.href='?lx=QA&lb=cj';"/>
        	</c:otherwise>
        </c:choose>
        </div>
    	<ul>
        	<c:forEach items="${requestScope.problem}" var="pro">
        		<c:choose>
        		<c:when test="${requestScope.lb=='cj'}">
        		<li><span>回答于：${pro.wdate}</span><a href="${applicationScope.path }/Post?pid=${pro.wpid}">${pro.pname}</a></li>
        		</c:when>
        		<c:otherwise>
        		<li><span>提问于：${pro.pdate}</span><a href="${applicationScope.path }/Post?pid=${pro.pid}">${pro.ptitle}</a></li>
        		</c:otherwise>
        		</c:choose>
        	</c:forEach>
        	<c:if test="${empty requestScope.problem}" var="ac">
	        	<li>Ta还没有提过问题!</li>
	        </c:if>
        </ul>
  	</div>
  </div>
  </c:if>
<!--活动部分-->
<c:if test="${requestScope.lx=='active'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">${requestScope.name}的活动</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<div class="Pro_Change">
        <c:choose>
    		<c:when test="${requestScope.lb=='cd'}">
    			<input type="button" class="Pro_Change_Btn" value='已发起' onclick="location.href='?lx=active&lb=fq';"/>
        		<input type="button" class="Join_Btn" value='已参加' disabled="true"/>
        	</c:when>
        	<c:otherwise>
        		<input type="button" class="Join_Btn" value='已发起' disabled="true"/>
        		<input type="button" class="Pro_Change_Btn" value='已参加' onclick="location.href='?lx=active&lb=cd';"/>
        	</c:otherwise>
        </c:choose>
        	
        </div>
    	<ul>
        	<c:forEach items="${requestScope.active}" var="active">
	        	<li><span>参加于：${active.jdate}</span><a href="${applicationScope.path }/Active">${active.aname}</a></li>
	        </c:forEach>
	        <c:if test="${empty requestScope.active}" var="ac">
	        	<li>Ta还没有参加过任何活动!</li>
	        </c:if>
        </ul>
  	</div>
  </div>
  </c:if>
<c:if test="${empty requestScope.state}" var="state">
<!--私信部分-->
<c:if test="${requestScope.lx=='private'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">私信/通知</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<div class="Pro_Change">
    	<c:choose>
    		<c:when test="${requestScope.lb=='tz'}">
    			<input type="button" class="Pro_Change_Btn" value='私信' onclick="location.href='?lx=private&lb=sx';"/>
        		<input type="button" class="Join_Btn" value='通知' disabled="true"/>
        		<a href="javascript:;" class="Notice_Btn">发私信</a>
        	</c:when>
        	<c:otherwise>
        		<input type="button" class="Join_Btn" value='私信' disabled="true"/>
        		<input type="button" class="Pro_Change_Btn" value='通知' onclick="location.href='?lx=private&lb=tz';"/>
        		<a href="javascript:;" class="Notice_Btn">发私信</a>
        	</c:otherwise>
        </c:choose>
        </div>
         <div class="Notice_Box">
        	<form action="?lx=private&action=send" name="send" method="post">
        	<table>
            <tr><td><input type="hidden" name="puid" value="${rquestScope.puid}"/>收件人：</td><td><input type="text" name="uname" value="${requestScope.sname}" onchange="seek(this.value);" style="border:1px solid #999;width:150px;height:30px;margin-bottom:10px;"/>
            <ul id="User_Result">
        	</ul></td></tr>
             <tr><td>　标题：</td><td><input type="text" name="title" style="border:1px solid #999;width:150px;height:30px;margin-bottom:10px;"/></td></tr>
            <tr><td valign="top">　内容：</td><td><textarea name="content" style="border:1px solid #999;width:500px;height:80px;"></textarea></td></tr>
            <tr><td>h</td><td align="right"><input type="submit" class="Focus_Btn" value="发送" onclick="ajaxBox(this,'SMS',2)"/></td></tr>
            </table>
            </form>
        </div>
    	<ul id="SMS_List">
    		<c:forEach items="${requestScope.pletter}" var="ple">
    			<c:choose>
    			<c:when test="${ple.pstate=='0'}">
        			<li><span><c:if test="${ple.ptype=='收信'}">来自：<font color='red'>${ple.puname}</font></c:if><c:if test="${ple.ptype=='发信'}">发送给：<font color='red'>${ple.puname}</font></c:if> ${ple.ppdate}<a href="javascript:getDel('?lx=private&lb=${requestScope.lb}&action=del&pid=${ple.pid}');">删除</a></span><a href="#" onclick="getPid(${ple.pid});"><font color="green">${ple.ptitle}</font></a></li>
        		</c:when>
        		<c:otherwise>
        			<li><span><c:if test="${ple.ptype=='收信'}">来自：<font color='red'>${ple.puname}</font></c:if><c:if test="${ple.ptype=='发信'}">发送给：<font color='red'>${ple.puname}</font></c:if> ${ple.ppdate}<a href="javascript:getDel('?lx=private&lb=${requestScope.lb}&action=del&pid=${ple.pid}');">删除</a></span><a href="#" onclick="getPid(${ple.pid});">${ple.ptitle}</a></li>
        		</c:otherwise>
        		</c:choose>
        	</c:forEach>
        	<c:if test="${empty requestScope.pletter}">
        		<li><h4>暂无最新消息</h4></li>
      
        	</c:if>
        </ul>
  	</div>
  </div>
  </c:if>
<!--修改部分-->
<c:if test="${requestScope.lx=='edit'}" var="qh">
  <div class="Pro_Left">
    <p class="Page_Title">修改资料</p>
    <div class="Title_Line"></div>
    <div class="Pro_Main">
    	<form method="post" action="Pro?lx=edit">
    	<input type="hidden" name="action" value="edit" />
        <table width="700" align="left" class="Pro_Edit_Table">
        <c:forEach items="${requestScope.user}" var="user">
        	<tr><td width="140" align="right">头像：</td><td><img src="${user.uphoto}"/></td></tr>
        	<tr><td align="right">真实姓名：</td><td>${user.uname }<span onclick="apply(this,'name');">(申请改名)</span></td></tr>
        	<tr><td align="right">验证邮箱：</td><td>${user.uemail }<span href="javascript:;" onclick="apply(this,'mail');">(修改验证邮箱)</span></td></tr>
        	<tr><td align="right">性别：</td><td>
        	<c:choose>
        		<c:when test="${user.usex=='男'}">
        			<input type="radio" name="sex" checked="checked" value="男"/>男
                	<input type="radio" name="sex" value="女"/>女
                </c:when>
                <c:otherwise>
                	<input type="radio" name="sex" value="男"/>男
                	<input type="radio" name="sex" checked="checked" value="女"/>女
                </c:otherwise>
        	</c:choose>
            	</td></tr>
        	<tr><td align="right">年龄：</td><td><input type="text" name="age" value="${user.uage}" class="Pro_Input" style="width:80px;"/>&nbsp;岁</td></tr>
        	<tr><td align="right">一句话介绍：</td><td><input type="text" name="info" value="${user.uinfo}" class="Pro_Input"/></td></tr>
        	<tr><td align="right">学校：</td><td><input type="text" name="school" value="${user.uschool }" class="Pro_Input"/></td></tr>
        	<tr><td align="right">专业：</td><td><input type="text" name="major" value="${user.ucareer }" class="Pro_Input"/></td></tr>
        	<tr><td align="right">擅长领域：</td><td><div class="Article_Field"><input type="hidden" name="filed" class="Public_Hidden" value="${user.uinterest }"/><c:forEach items="${requestScope.good}" var="at">${at.ftype}</c:forEach></div></td></tr>
        	<tr><td align="right">关注领域：</td><td><div class="Article_Field"><input type="hidden" name="attention" class="Public_Hidden" value="${user.ufiled}"/><c:forEach items="${requestScope.atten}" var="att">${att.ftype}</c:forEach></div></td></tr>
        	<tr><td></td><td><input type="submit" class="Blue_Button" value="保存资料"/></td></tr>
        </c:forEach>
        </table>
        </form>
  	</div>
  </div>
</c:if>
</c:if>
  <div class="Pro_Right">
  	<ul class="Pro_Menu">
    	<li><a href="?lx=index" class="Pro_Menu_Current">个人主页</a></li>
    	<li><a href="?lx=attention">关注</a></li>
    	<li><a href="?lx=post">帖子</a></li>
    	<li><a href="?lx=QA">问答</a></li>
    	<li><a href="?lx=active">活动</a></li>
    	<c:if test="${empty requestScope.state}" var="state">
    		<li><a href="?lx=private">私信/通知</a></li>
    		<li><a href="?lx=edit">修改资料</a></li>
    	</c:if>
    </ul>
  </div>
</div>
<div class="Page_Bottom"></div>
<!--版权部分-->
<div class="Bottom">
  <p><a href="#"><img src="images/LOGO_gray.jpg" align="left"/></a> <a href="#">奋青首页</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">社团中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">交流圈子</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">活动中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">帮助中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">使用反馈</a>&nbsp;&nbsp;|&nbsp;&nbsp;联系我们：<a href="mailto:scdzwyxst@gmail.com">scdzwyxst@gmail.com</a>&nbsp;&nbsp;<br />
    CopyRight&copy;&nbsp;2012&nbsp;MayDay  All Rights Reserved</p>
</div>
</body>
</html>
